#include "Tile.h"
#include "ClientSettings.h"



Tile::Tile( int _x, int _y, int _size, UINT _line, UINT _col )
	: mLetter(' '), mLine( _line ), mCol( _col )
{
	RECT tmpRect = { _x, _y, _x + _size, _y + _size};
	mSquare = tmpRect;
	//mState.Set( TileState::EMPTY);
}


Tile::Tile( RECT& _rect )
		: mLetter(' ')
{
	mSquare = _rect;
	//mState.Set( TileState::EMPTY);
}


Tile::~Tile(void)
{

}

bool Tile::ContainsPoint( int _x, int _y )
{
	if( mSquare.left <= _x && mSquare.right >= _x
		&& mSquare.top <= _y && mSquare.bottom >= _y)
		return true;

	return false;
}

void Tile::Clone( Tile* _tile )
{
	mLine = _tile->mLine;
	mCol = _tile->mCol;
	mLetter = _tile->mLetter;
	mSquare = _tile->mSquare;
	mState = _tile->mState;
}

void Tile::Pos( int _x, int _y )
{
	mSquare.left = _x + 4;
	mSquare.right = mSquare.left + ClientSettings::BOARD_LETTERS_SIZE;
	mSquare.top = _y;
	mSquare.bottom = mSquare.top + ClientSettings::BOARD_LETTERS_SIZE;
}

void Tile::Letter( char _newLetter )
{
	mLetter = _newLetter;
}

TileState& Tile::State()
{
	return mState;
}

